package com.phospherus.flow.repository

import com.phospherus.common.repository.BaseRepository
import com.phospherus.flow.entity.WorkFlowInst
import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.query.Param

/**
 * @author songjinlong
 * @version 1.0
 * @since 2017/12/22
 */
interface WorkFlowInstRepository : BaseRepository<WorkFlowInst, Long> {
    @Query(value = "select * from work_flow_inst where curr_user_id= :uId and work_flow_type=0", nativeQuery = true)
    fun getDraftListByUserId(@Param("uId") uId: Long): List<WorkFlowInst>

    @Query(value = "select * from work_flow_inst where form_inst_id= :formInstId and work_flow_type < 2", nativeQuery = true)
    fun getCurrWorkFlowInstByFromInstId(@Param("formInstId") formInstId: Long): WorkFlowInst?
}